<?php
/**
 * Created by PhpStorm.
 * User: Hasee
 * Date: 2020/3/27
 * Time: 2:30
 */
/*$data=mysqli_query($mysql,"SELECT * FROM student1 LIMIT 1");
var_export(mysqli_fetch_assoc($data));*/
//echo '这里是table';
//var_export($_GET);
//var_export($_POST);
//echo '新的内容';
$page=$_GET['page'];//获取页码
$page=(int)$page;
if ($page<1)
{
    $page=1;        //当得到的内容小于1转数字1
}
$start=($page-1)*10;    //计算每一页的起始位置
$data=mysqli_query($mysql,"SELECT COUNT(*) AS count FROM student");
$count=mysqli_fetch_assoc($data);
$count=$count['count'];
$data=mysqli_query($mysql,"SELECT * FROM student ORDER BY uid DESC LIMIT $start,10");
$count=ceil($count/10);
$arr=array();
while ($a=mysqli_fetch_assoc($data))
{
    $arr[]=$a;
}
mysqli_free_result($data);
echo json_encode(array(
    'data'=>$arr,
    'count'=>$count
));//json格式输出